package com.itheima.d4_create_thread;

public class ThreadTest2Practice {
    public static void main(String[] args) {
        Thread t1 = new Thread(new MyRunnable("小红"));

        t1.start();

        new Thread(new MyRunnable("小绿")).start();

        Thread t2 = new Thread(() -> System.out.println("我是Lambda方法实现～"));

        Thread t3 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是匿名内部类方式～");
            }
        });
        t3.start();
    }
}

class MyRunnable1 implements Runnable {
    String name;

    public MyRunnable1(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(name + " : " + i);
        }
    }
}